//
//  RoomDTO.swift
//
//
//  Created by Jiang Chencheng on 2024/9/5.
//

import Fluent
import Vapor

struct RoomDTO: Content {
    
    var id: UUID?
    var name: String?
    var pet: Pet?
    var star: UInt?
    var hot: UInt?
    var energy: UInt?
    
    func toModel() -> Room {
        let model = Room()
        
        model.id = self.id
        if let name = self.name {
            model.name = name
        }
        if let pet = self.pet {
            model.pet = pet
        }
        if let star = self.star {
            model.star = star
        }
        if let hot = self.hot {
            model.hot = hot
        }
        if let energy = self.energy {
            model.energy = energy
        }
        
        return model
    }
}


